package com.gsj.system.controller;

import com.gsj.common.pojo.R;
import com.gsj.system.config.OperLog;
import com.gsj.system.pojo.MenuVo;
import com.gsj.system.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: clmseighth
 * @description:
 * @author: 张巍蓝
 * @create: 2021-07-19 19:50
 **/

@RestController
@RequestMapping("system/menu")
public class MenuController {
    @Autowired
    private MenuService menuService;
    @RequestMapping("queryMenubyUserid")
    @OperLog( title= "通过userid查询菜单表",operatorType ="0",business_type = "0")
    public R queryMenubyUserid(){
        return  menuService.queryMenu();
    }
    @GetMapping("getMenuByRoleId/{roleId}")
    @OperLog( title= "通过roleid查询菜单表",operatorType ="0",business_type = "0")
    public R getMenuByRoleId(@PathVariable("roleId") Integer roleId){
        return  menuService.getMenuByRoleId(roleId);
    }
    @PostMapping("addMenu/{username}")
    @OperLog( title= "新增菜单表",operatorType ="0",business_type = "0")
    public R addMenu(@RequestBody MenuVo menuVo,
                     @PathVariable("username") String username
                     ){
        return  menuService.addMenu(menuVo,username);
    }
    @GetMapping("queryAllFatherId")
    @OperLog( title= "查询所有菜单表中的父菜单",operatorType ="0",business_type = "0")
    public R queryAllFatherId(){
        return  menuService.queryAllFatherId();
    }
}
